package com.mlming.springboot.controller;

import com.mlming.springboot.consts.WallConst;
import com.mlming.springboot.enums.ResponseEnum;
import com.mlming.springboot.form.UserForm;
import com.mlming.springboot.pojo.User;
import com.mlming.springboot.service.UserService;
import com.mlming.springboot.vo.ResponseVo;
import com.mlming.springboot.vo.UserVo;
import jdk.nashorn.internal.runtime.regexp.joni.Regex;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.regex.Pattern;

@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/schoolNum")
    public ResponseVo schoolNumCheck(String schoolNum) {
        return userService.schoolNumCheck(schoolNum);
    }

    @PostMapping("/userName")
    public ResponseVo usernameCheck(String username) {
        return userService.usernameCheck(username);
    }

    @PostMapping("/password")
    public ResponseVo passwordCheck(String password) {
        return userService.passwordCheck(password);
    }

    @PostMapping("/register")
    public ResponseVo register(UserForm userForm) {
        ResponseVo<UserVo> responseVo = userService.register(userForm);
        return responseVo;
    }

    @PostMapping("/login")
    public ResponseVo login(UserForm userForm) {
        ResponseVo<UserVo> responseVo = userService.login(userForm);
        return responseVo;
    }
}
